const { UserDeviceModel } = require('../../models/models');


//根据用户名获取所有设备
function getUserDevice(username) {
    if (username) {
        return new Promise((res, rej) => {
            UserDeviceModel.find({ username }).then(docs => {
                res({ status: 0, data: docs })
            }).catch(err => {
                console.log(err)
                res({ status: 1 })
            })
        })
    }else{
        return{status:1,data:'用户名无效'}
    }
}





module.exports = getUserDevice

